import HTTP, { HttpMethods } from "@/http";
import { UserApi,UserInfoApi } from "./type";

const $h = new HTTP({ timeout: 5000, baseURL: import.meta.env.VITE_API_URL })

export const userApi = <M extends UserApi.Methods>(params: UserApi.Params<M>, method: M) => {
    return $h[method]<UserApi.ResponseData<M>>(UserApi.URL, params)
}
export const getUserInfoApi = () => {
    return $h.get<UserInfoApi.ResponseData>(UserInfoApi.URL)
}